package com.neusoft.controller.registration;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.neusoft.bean.NewPageBean;
import com.neusoft.bean.PageBean;
import com.neusoft.bean.PageRequestDto;
import com.neusoft.service.RegisterService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/registers")
//@CrossOrigin
public class RegisterController {

    @Autowired
    private RegisterService
            registerService;

    @GetMapping("/getMaxCaseNumber")
    public String getMaxCaseNumber(){
        return registerService.getMaxCaseNumber();
    }

    @GetMapping("/getDoctorUsedNumber")
    public Integer getDoctorUsedNumber(Integer doctorId){
        Integer number=registerService.getDoctorUsedNumber(doctorId);
        return number;
    }

    @PostMapping("/saveRegister")
    public String saveRegister(@RequestBody Map<String,Object> register){
        return registerService.saveRegister(register);
    }

    @GetMapping("/getFinishPatientCount")
    public Integer getFinishPatientCount(Integer employeeId){
        return registerService.getFinishPatientCount(employeeId);
    }
    @GetMapping("/getWaitPatientCount")
    public Integer getWaitPatientCount(Integer employeeId){
        return registerService.getWaitPatientCount(employeeId);
    }


    @GetMapping("/getWaitPatient")
    public PageBean getWaitPatient(
            @RequestParam(defaultValue = "1") Integer page,
            @RequestParam(defaultValue = "5") Integer pageSize,
            @RequestParam Integer employeeId,
            String caseNumber,
            String realName){
        return registerService.getWaitPatient(page,pageSize,employeeId,caseNumber,realName);

    }
    @PostMapping("/getWaitCheckPatient")
    public NewPageBean getWaitCheckPatient(@RequestBody PageRequestDto pageRequestDto) {
        return registerService.getWaitCheckPatient(pageRequestDto);
    }

}
